package com.hyt.it.ogt.pj.enums;

import lombok.Getter;

/**
 * @Description:
 * @Author: STARF
 * @CreateDate: 2022/04/09 17:43
 **/
@Getter
public enum ItemTypeEnum {

    short_answer("short_answer", "简答题"),
    picture_answer("picture_answer", "图片答案题"),
    fill_in_blanks("fill_in_blanks", "填空题"),
    multiple("multiple", "多选题"),
    single("single", "单选题"),
    compound("judgment", "判断题");


    private final String code;
    private final String name;

    ItemTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ItemTypeEnum getByCode(String code) {
        for (ItemTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String getNameByCode(String code) {
        for (ItemTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

}
